/**
 *script for Ajax search 
 */

function searchCourse(){
	var searchRes = document.getElementById("search_results");
	var request = new XMLHttpRequest();
	var courseName = "course_name=" + document.getElementById("input_course_name").value;
	var courseDesc = "course_description=" + document.getElementById("input_course_description").value;
	var courseGroup = "course_group=" + document.getElementById("input_course_group").value;
	var creditPoints = "credit_points=" + document.getElementById("input_credit_points").value;
	var params = courseName + "&" + courseDesc + "&" + courseGroup + "&" + creditPoints;
	
	request.open("GET", "SearchCourse" + "?" + params, false);
	request.send(null);
	if(request.status==200){
		searchRes.innerHTML = request.responseText;
	}      
	else {
		searchRes.innerHTML = "<i>Can't get results from server...<\/i>";
	}
	
}